#pragma once
#include<sys/stat.h>
#include<sys/types.h>
#include<stdio.h>
#include<stdlib.h>
#include<unistd.h>



#define FIFO_FILE "myfifo"
#define MODE 0666


enum
{
    FILE_CREATE_ERR = 1,
    FILE_DELETE_ERR,
    FILE_OPEN_ERR
};


class Init
{
public:
    Init()
    {
        int n = mkfifo(FIFO_FILE,MODE);
        if(n == -1)
        {
            perror("mkfifo");
            exit(FILE_CREATE_ERR);
        }
    }

    ~Init()
    {
        int n = unlink(FIFO_FILE);
        if(n == -1)
        {
            perror("unlink");
            exit(FILE_DELETE_ERR);
        }
    }

};